package com.briup.cms.web.controller;

import com.briup.cms.bean.Inform;
import com.briup.cms.service.IInformService;

import com.briup.cms.utils.Message;
import com.briup.cms.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(description="文章操作信息管理接口")
@RequestMapping("/inform")
@RestController

public class InformController {
    @Autowired
    private IInformService informService;

    @ApiOperation(value = "查询所有")
    @GetMapping("findAllWithArticle")
    public Message findAllWithArticle(){
        List<Inform> list=informService.findAll();
        return MessageUtil.success(list);
    }


    @ApiOperation("插入或更新")
    @GetMapping("insertOrUpdate")
    public Message insertOrUpdate(Inform inform){
        informService.insertOrUpdate(inform);
        return MessageUtil.success("操作成功");
    }
    @ApiOperation("按id删除记录")
    @GetMapping("delete")
    public Message delete(Long id){
        informService.deleteByld(id);
        return MessageUtil.success("删除成功");
    }

}
